package HotelsData;


/**
 *
 * @author Zainab MAAMAR
 */
import javax.xml.bind.*;
import java.io.*;
import java.util.*;
public class XmltoJava {
	
	public static Hotels getEvent(String file) {
            Hotels hotels = null;
            
		try {
		JAXBContext jc = JAXBContext.newInstance("HotelsData");
	      Unmarshaller unmarshaller = jc.createUnmarshaller();
	      hotels= (Hotels) unmarshaller.unmarshal(new File(file));
	      
	  
	    } catch (Exception e) {
	      e.printStackTrace();
	      System.out.println("Erreur dans la lecture du fichier");
	    }
		return hotels;
		
	}

  public static void main(String[] args) {

    try {
      JAXBContext jc = JAXBContext.newInstance("HotelsData");
      Unmarshaller unmarshaller = jc.createUnmarshaller();
      Hotels hotels = (Hotels) unmarshaller.unmarshal(new File("ressources/Hotel.xml"));

     System.out.println(hotels.getPays().size());
  
    } catch (Exception e) {
      e.printStackTrace();
    }
}
}